package com.example.controller;

import com.example.utils.Result;
import com.example.utils.UserUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
public class TestController {

    private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @RequestMapping(value = "getTime")
    public Result getTime() {
        System.out.println("当前用户id: " + UserUtils.getUserId());
        return Result.success(simpleDateFormat.format(new Date()));
    }
}
